import { IParam, EntityBase } from '@/core';
import { ISys_granted_authority } from './interface/i-sys-granted-authority';
import Sys_granted_authorityKeys from './sys-granted-authority-keys';

/**
 * 角色授权资源基类
 * 基于template/src/api/{{appEntities}}/{{appEntities}}-base.ts.hbs生成
 *
 * @export
 * @abstract
 * @class Sys_granted_authorityBase
 * @extends { EntityBase }
 * @implements { ISys_granted_authority }
 */
export abstract class Sys_granted_authorityBase
	extends EntityBase
	implements ISys_granted_authority
{
	/**
	 * 实体名称
	 *
	 * @readonly
	 * @type {string}
	 * @memberof Sys_granted_authorityBase
	 */
	get srfdename(): string {
		return 'SYS_GRANTED_AUTHORITY';
	}

	/**
	 * 当前实体所有属性
	 *
	 * @protected
	 * @type {string[]}
	 * @memberof Sys_granted_authorityBase
	 */
	protected get keys(): string[] {
		return Sys_granted_authorityKeys;
	}

	/**
	 * Creates an instance of ConstactOppoBase.
	 * @param {*} [data]
	 * @memberof Sys_granted_authorityBase
	 */
	constructor(data?: any) {
		super();
		this.setData(data);
	}

	get srfkey(): string {
		return this.id;
	}

	set srfkey(val: string) {
		this.id = val;
	}

	get srfmajortext(): string {
		return this.id;
	}

	set srfmajortext(val: string) {
		this.id = val;
	}
	/**
	 * 标识
	 **/
	id?: any;

	/**
	 * 创建人
	 **/
	creator?: any;

	/**
	 * 创建时间
	 **/
	create_time?: any;

	/**
	 * 最后更新人
	 **/
	updater?: any;

	/**
	 * 最后更新时间
	 **/
	update_time?: any;

	/**
	 * DC
	 **/
	dc?: any;

	/**
	 * 角色标识
	 **/
	role_id?: any;

	/**
	 * 资源符
	 **/
	authority?: any;

	/**
	 * 显示名
	 **/
	display_name?: any;

	/**
	 * 类型
	 **/
	permission_type?: any;

	/**
	 * 重置实体数据
	 *
	 * @param {IParam} [data={}]
	 * @memberof Sys_granted_authorityBase
	 */
	reset(data: IParam = {}): void {
		super.reset(data);
		this.id = data.id || data.srfkey;
		this.id = data.id || data.srfmajortext;
	}
}
